from playwright.sync_api import sync_playwright
from time import sleep
import pytest
@pytest.fixture(scope='module')
def browser():
    with sync_playwright() as p:
        browser=p.chromium.launch(headless=False)
        yield browser
        browser.close()
@pytest.fixture
def page (browser):
    page = browser.new_page()
    yield page
    page.close()
def test_login(page):
    # 访问网站
    page.goto('https://www.jiuxian.com/')
    # 点击首页登录
    page.click('a[class="headerLogin"]')
    # 输入账号
    page.fill('input[id="userName"]','17518836160')
    # 输入密码
    page.fill('input[id="password"]','123456Aa')
    sleep(7)
    # 点击登录
    page.click('input[id="save"]')
    sleep (2)
    # 点击确定
    page.click('a[id="bindSub"]')
    sleep(3)